<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<%@page import="fr.gest4team.app.pilotage.metier.PlanningOm"%>
<%@page import="fr.gest4team.app.pilotage.metier.ActeurOm"%>
<%@page import="fr.gest4team.app.pilotage.metier.TacheOm"%>
<%@page import="java.util.List"%>
<%@page import="fr.gest4team.app.pilotage.metier.VersionOm"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="css/main.css" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Saisie de l'activite</title>	
<%
ActeurOm acteur = (ActeurOm) request.getAttribute("ACTEUR");
String annee = (String) request.getAttribute("ANNEE");
String semaine = (String) request.getAttribute("SEMAINE");
List<PlanningOm> plannings = (List<PlanningOm>) request.getAttribute("PLANNINGS");

Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.WEEK_OF_YEAR, Integer.parseInt(semaine));
calendar.set(Calendar.YEAR, Integer.parseInt(annee));



%>

<script type="text/javascript">
	function supprimer(version, id) {		
		 document.getElementById("action").value="delete";
		 document.getElementById("version").value=version;
		 document.getElementById("idversion").value=id;
		 document.getElementById("formulaire").submit();
	}
	
	function creer() {
		document.getElementById("action").value="create";
		document.getElementById("formulaire").submit();
	}
	
	
</script>
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
	<form id="formulaire" name="formulaire" action="/Pilotage/tache.do" method="post">
		<div align="center">
		<table>
			<caption>Semaine <%=semaine%> <%=annee%></caption>
			<%
			  DateFormat formater = new SimpleDateFormat("dd/MM");			
			%>
			<thead>
			<tr>								
				<th  width="90" scope="col">Lundi<br/><%=formater.format(calendar.getTime())%></th>
				<%calendar.add(Calendar.DAY_OF_MONTH, 1);%>
				<th  width="90" scope="col">Mardi<br/><%=formater.format(calendar.getTime())%></th>
                <%calendar.add(Calendar.DAY_OF_MONTH, 1);%>
				<th  width="90" scope="col">Mercredi<br/><%=formater.format(calendar.getTime())%></th>
                <%calendar.add(Calendar.DAY_OF_MONTH, 1);%>
				<th  width="90" scope="col">Jeudi<br/><%=formater.format(calendar.getTime())%></th>
				<th  width="90" scope="col">Vendredi<br/><%=formater.format(calendar.getTime())%></th>                
				<th  width="90" scope="col">GAP</th>				
				<th  width="500" scope="col">Commentaire</th>
			</tr>
			</thead>
			<tbody>
			<%
			try {    
			int index = 0;  
			for (PlanningOm planning : plannings) {				
			%>			
			<tr <%= (index % 2 == 1) ? "class='odd'" : "" %>>				
				<td width="90" ><input type="text" id="1-<%=semaine%>-<%=annee%>" size="3"></input></td>
				<td width="90" ><input type="text" id="2-<%=semaine%>-<%=annee%>" size="3"></td>
				<td width="90" ><input type="text" id="3-<%=semaine%>-<%=annee%>" size="3"></td>
				<td width="90" ><input type="text" id="4-<%=semaine%>-<%=annee%>" size="3"></td>
				<td width="90" ><input type="text" id="5-<%=semaine%>-<%=annee%>" size="3"></td>				
				<td width="90" size="200" ><%=planning.getTache()%></td>
				<td width="500" ><input type="text" id="1-<%=semaine%>-<%=annee%>" value="<%=planning.getCommentaire()%>" size="100"></td>
			</tr>
			<%
			    index++;
			    }
			} catch(Exception e) {
			    e.printStackTrace();
			}
			%>	
			<tbody>	
			<tfoot>
			 <tr>
			     <th>Synthese</th>
			     <th>Synthese</th>
			     <th>Synthese</th>
			     <th>Synthese</th>
			     <th>Synthese</th>
			 </tr>
			</tfoot>	
		</table>
		</div>
		<input type="hidden" name="action" id="action"></input> 
		<input type="hidden" name="idtache" id="idtache"></input>
		<input type="hidden" name="version" id="version"></input>
		<input type="hidden" name="idversion" id="idversion"></input>
		<input type="hidden" name="code" id="code"></input>		
	</form>
</body>
</html>